package com.KeyWord.equals_.Case;

public class Case {
    public static void main(String[] args) {

        //Object类以及其子类在比较的是引用地址，也就是是否为同一个对象
        Person person1 = new Person('男',"Moose",90);
        Person person2 = new Person('男',"Moose",90);
        System.out.println(person1.equals(person2));
        System.out.println(person1 == person2);//地址不一样

        //但是Object子类被高斯林改写了，比较的是具体内容
        String s1 = new String("Moose");
        String s2 = new String("Moose");
        String s3 = s2;
        System.out.println(s3.equals(s2));//具体内容相等
        System.out.println(s1 == s2);//地址不同
        System.out.println(s3 == s2);//地址相同



    }
}

class Person {

    private String name;
    private int age;
    private  char gender;

    public Person(char gender, String name, int age) {
        this.gender = gender;
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}









